import SpReact from "./SpReact"
// function  Hello() {
//     return <div><h1>Hello</h1></div>
// }
// export default function App(props) {
//     return <div><h1>{props.title}</h1><p>123</p><Hello/></div>
// }

class App extends SpReact.Component{
    constructor(props) {
        super(props)
        this.state = {
            // title: 'App',
            count: 0
        }
        this.handleClick = this.handleClick.bind(this)
    }
    handleClick(){
        let count = this.state.count + 1
        this.setState({
            count: count++
        })
    }
    componentWillReceiveProps(props){
        console.log('componentWillReceiveProps:',props)
    }
    componentWillUpdate(){
        console.log('componentWillUpdate')
    }
    componentDidUpdate(preProps){
        console.log('componentDidUpdate',preProps)
    }
    render() {
        console.log('render')
        return (
            <div>
                <h1>{this.props.title},count：{this.state.count}</h1>
                <button onClick={this.handleClick}>change title</button>
            </div>
        )
    }
}
export default App